package com.qf.main.content.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qf.common.base.result.ResponseResult;
import com.qf.main.content.common.qo.DiscoveryQo;
import com.qf.main.content.common.vo.DiscoveryVo;
import com.qf.main.content.service.DiscoveryService;
// import com.qf.main.login.entity.SysUser;
// import org.apache.shiro.SecurityUtils;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author chengqiang
 * @Create 2024-01-22-21:07
 * @Description:
 */
@RestController
@RequestMapping("/discovery")
@CrossOrigin
@Api(tags = "发现管理")
public class DiscoveryController {

    @Resource
    private DiscoveryService discoveryService;

    @GetMapping("/list/pagNum/pageSize")

    public ResponseResult<IPage<DiscoveryVo>> listDiscovery(@PathVariable(required = false) Integer pageNum,
                                                            @PathVariable(required = false) Integer pageSize,
                                                            @RequestParam("keywords") String keywords){
        return  ResponseResult.success(discoveryService.listDiscovery(pageNum,pageSize,keywords));
    }
    @PostMapping("/save")
    public ResponseResult<Integer> saveDiscovery(@RequestBody DiscoveryQo discoveryQo){
        return ResponseResult.success(discoveryService.saveDiscovery(discoveryQo));
    }
    @DeleteMapping("/edit")
    public ResponseResult<Integer> editDiscovery(@RequestParam("id") Integer id){
        return ResponseResult.success(discoveryService.deleteDiscovery(id));
    }
    @PutMapping("/erase")
    public ResponseResult<Integer> eraseDiscovery(@RequestBody DiscoveryQo discoveryQo){
        return ResponseResult.success(discoveryService.modify(discoveryQo));
    }





}
